home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / tasks / src / setexcept.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-16  |  1.9 KB  |  89 lines

  1. /*
  2.     $Id: setexcept.c 1.1 1995/12/17 21:37:10 digulla Exp digulla $
  3.     $Log: setexcept.c $
  4.  * Revision 1.1  1995/12/17  21:37:10  digulla
  5.  * Initial revision
  6.  *
  7.     Desc:
  8.     Lang: english
  9. */
  10. #include "exec_intern.h"
  11.  
  12. /*****************************************************************************
  13.  
  14.     NAME */
  15.     #include <clib/exec_protos.h>
  16.  
  17.     __AROS_LH2(ULONG, SetExcept,
  18.  
  19. /*  SYNOPSIS */
  20.     __AROS_LA(unsigned long, newSignals, D0),
  21.     __AROS_LA(unsigned long, signalSet, D1),
  22.  
  23. /*  LOCATION */
  24.     struct ExecBase *, SysBase, 52, Exec)
  25.  
  26. /*  FUNCTION
  27.     Change the mask of signals causing a task exception.
  28.  
  29.     INPUTS
  30.     newSignals - Set of signals causing the exception.
  31.     signalSet  - Mask of affected signals.
  32.  
  33.     RESULT
  34.     Old mask of signals causing a task exception.
  35.  
  36.     NOTES
  37.  
  38.     EXAMPLE
  39.  
  40.     BUGS
  41.  
  42.     SEE ALSO
  43.     AllocSignal(), FreeSignal(), Wait(), SetSignal(), Signal()
  44.  
  45.     INTERNALS
  46.  
  47.     HISTORY
  48.     29-10-95    digulla automatically created from
  49.                 exec_lib.fd and clib/exec_protos.h
  50.     17-12-95    digulla Incorporated code by Matthias Fleischner
  51.  
  52. *****************************************************************************/
  53. {
  54.     __AROS_FUNC_INIT
  55.     struct Task *me;
  56.     ULONG old;
  57.  
  58.     /* Get pointer to current task */
  59.     me=SysBase->ThisTask;
  60.  
  61.     /* Protect mask of sent signals and task lists */
  62.     Disable();
  63.  
  64.     /* Get returncode */
  65.     old=me->tc_SigExcept;
  66.  
  67.     /* Change exception mask */
  68.     me->tc_SigExcept=(old&~signalSet)|(newSignals&signalSet);
  69.  
  70.     /* Does this change include an exception? */
  71.     if(me->tc_SigExcept&me->tc_SigRecvd)
  72.     {
  73.     /* Yes. Set the exception flag. */
  74.     me->tc_Flags|=TF_EXCEPT;
  75.  
  76.     /* Are taskswitches allowed? (Don't count own Disable() here) */
  77.     if(SysBase->TDNestCnt>=0||SysBase->IDNestCnt>0)
  78.         /* No. Store it for later. */
  79.         SysBase->AttnResched|=0x80;
  80.     else
  81.         /* Switches are allowed. Force a rescedule. */
  82.         Switch();
  83.     }
  84.     Enable();
  85.  
  86.     return old;
  87.     __AROS_FUNC_EXIT
  88. } /* SetExcept */
  89.